UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iIDQHzazw+Us8tDTe0FdHliBazb0a1TQAgIuIVReQyk=' 
WHERE 
  key_id = '5a3350eae3c77d490a62515dfbbba710015951eff0efdf87ab4292cca71df340' 
  AND (
    token = 'iIDQHzazw+Us8tDTe0FdHliBazb0a1TQAgIuIVReQyk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033