UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vVYXSyMIW0UFKNK6Xifn2zNFyOr2et4B45iuDOghqn8=' 
WHERE 
  key_id = '5731f50ea47c0ce7a2ee584360f62dd1cb893f97a53c5e55aebac88c38dd9bfe' 
  AND (
    token = 'vVYXSyMIW0UFKNK6Xifn2zNFyOr2et4B45iuDOghqn8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034