UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iLa8mEYt+8viMR18p1f5rHuDqCl523LCfEoOMHdpNQ8=' 
WHERE 
  key_id = '51eb583a0771bfe9f5f7f058a47cb8f2ccdf3bea8e74e35c771c914a9aff612f' 
  AND (
    token = 'iLa8mEYt+8viMR18p1f5rHuDqCl523LCfEoOMHdpNQ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063