UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NFvJN0u6O0DNku3dUfSxVCyL6g9Qw1YKI/qsuWsuBEs=' 
WHERE 
  key_id = 'd13e018462a7b6275e2679f079c1f4e0476485e4e3a45a19b07099b0c4eb1223' 
  AND (
    token = 'NFvJN0u6O0DNku3dUfSxVCyL6g9Qw1YKI/qsuWsuBEs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046