UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2nB8TrgbCrknyANijV5DZDe6r/lWI2VR8EJvhyxhxeU=' 
WHERE 
  key_id = 'a632a502ab444bab621ad26ac8c2c6d1563cd1a578fe3238d852fee2df106857' 
  AND (
    token = '2nB8TrgbCrknyANijV5DZDe6r/lWI2VR8EJvhyxhxeU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030