UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '097WYmbq/iitQBc6Jj9NcvIrq+HUTdxPECWEt72XtvE=' 
WHERE 
  key_id = '078b665cc8e2a228e85a92a0798d782792547a6b74edbfc42be6ab6de5a83fd5' 
  AND (
    token = '097WYmbq/iitQBc6Jj9NcvIrq+HUTdxPECWEt72XtvE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053