UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xx+71dq5zNVIPcA8Eh7+RcTMCMnHfiM0CyMq6Xspfu8=' 
WHERE 
  key_id = '14b3912fdb48a529c21961ad7f2802c79254eac5d84fb25821308122255dcf45' 
  AND (
    token = 'xx+71dq5zNVIPcA8Eh7+RcTMCMnHfiM0CyMq6Xspfu8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034