UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eCTpJfUn1UiYb/6cutJOUqqakCOtZkWFeQHR4xoxSOc=' 
WHERE 
  key_id = '8f8514c9ca61dabf2c3f67c48ec8c1c49cf15914fe2676550b22b1cf2ecbf50e' 
  AND (
    token = 'eCTpJfUn1UiYb/6cutJOUqqakCOtZkWFeQHR4xoxSOc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030