UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gGPRP0VUsRAchnFR9P/p2IRcKGbj5PsHcUlKXCcHOhE=' 
WHERE 
  key_id = '4a7c86a01449f86b39a7391b1d145292a9665d2d38b9cc3d12625ecbb84a0ad3' 
  AND (
    token = 'gGPRP0VUsRAchnFR9P/p2IRcKGbj5PsHcUlKXCcHOhE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019