UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PJ4EhcxK+xcf78vXQAIq4ryNELgI1G2w2PhGIVnyO5s=' 
WHERE 
  key_id = '4799b754e866155bc6a9aeaea3d89f2c57d8e4b8b4eda8fd2c294715b02e33e3' 
  AND (
    token = 'PJ4EhcxK+xcf78vXQAIq4ryNELgI1G2w2PhGIVnyO5s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043