UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y70s2vZ0sIwcY9f+VocN/JnAfRvB4aanrJ+Kg82D90w=' 
WHERE 
  key_id = '83b7d3a0636daa102300fe4c7a99078610fae694c30a72dd991676b2c9343d61' 
  AND (
    token = 'Y70s2vZ0sIwcY9f+VocN/JnAfRvB4aanrJ+Kg82D90w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046