UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6R8HLVbhslBfdND+1nunDYMPGG6v/r9taUMtEhJEFzc=' 
WHERE 
  key_id = 'ba0b068c9447e5566856dcee8e3a8fce769a729b63a35dcec47482c8b60425b8' 
  AND (
    token = '6R8HLVbhslBfdND+1nunDYMPGG6v/r9taUMtEhJEFzc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023