UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UktOGryzzo5kG8s2gnZoBBC5DcIXHT43AjuUa987vd4=' 
WHERE 
  key_id = 'a05f9e90922f3a34b30295c0c5ab391cd9d440e109fdb04db88c4362b3018a10' 
  AND (
    token = 'UktOGryzzo5kG8s2gnZoBBC5DcIXHT43AjuUa987vd4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049