UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LL17vrHH4LH60bBKApErIlhkXvvMNhwQNrNgefIt2Ts=' 
WHERE 
  key_id = '160afdf1abf77b6d722b4e8e1010c8f6c3065771070aeb9f25c10bdd2241ee47' 
  AND (
    token = 'LL17vrHH4LH60bBKApErIlhkXvvMNhwQNrNgefIt2Ts=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026