UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RhKakAsGOcMw1NdH1AFOk8SNZJtQP9A0HJHp2nBS3Ls=' 
WHERE 
  key_id = 'a54aa02c1e63dd5a291a8f202049fa9660dd987d787a6194ebbd01da8caca944' 
  AND (
    token = 'RhKakAsGOcMw1NdH1AFOk8SNZJtQP9A0HJHp2nBS3Ls=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052