UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xSonFBpamJ8d6zH/wSNQhjxDULaZhvHn0mMvCDekODc=' 
WHERE 
  key_id = '0cb35072144fa2992645fd48a17e7357e5b3e9acb33bc744b6520c69facdeff3' 
  AND (
    token = 'xSonFBpamJ8d6zH/wSNQhjxDULaZhvHn0mMvCDekODc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034