UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ihBUzMthwSWrTYpKyhsnSalf6oZAMiZJY6MgMV2JT6Q=' 
WHERE 
  key_id = '5dd26c83570bff0162df3cb70715ef75faa884222bab56f4e533d112106648ad' 
  AND (
    token = 'ihBUzMthwSWrTYpKyhsnSalf6oZAMiZJY6MgMV2JT6Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036