UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yjxEpcYuJZNWpy4ehC5MpEbXVigrTH/NrHJ/pZdq3gw=' 
WHERE 
  key_id = 'a027f7071c593523168461e172406d8a6d19ab70e373e9c4f5f66c4e48962a2a' 
  AND (
    token = 'yjxEpcYuJZNWpy4ehC5MpEbXVigrTH/NrHJ/pZdq3gw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039