UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E09zUE0FZHOwN6DVCIpoqsZDATUG6Iq3RRHHtFs550k=' 
WHERE 
  key_id = '10fd18410c16e7b6c8cf296db6ab9e1ec1bb7d3a46d7376b3d1d90de364edea8' 
  AND (
    token = 'E09zUE0FZHOwN6DVCIpoqsZDATUG6Iq3RRHHtFs550k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034