UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1OrdapUuXKBewLp292l1Gz+d9kfaDbalazZjakKu8B8=' 
WHERE 
  key_id = '9d75c17478bc6ba69b0c1f93f75b4c9971038912219e1c18991135b9ac1f3940' 
  AND (
    token = '1OrdapUuXKBewLp292l1Gz+d9kfaDbalazZjakKu8B8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020