UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zlon+aWq78QTKGzzp5UPU8vZchQ0rPJ+8eISxiLIhXo=' 
WHERE 
  key_id = 'cbd0e376dc2b4524c068b9955d8c8c25f871ac12329552dbef9344b608eddcfa' 
  AND (
    token = 'zlon+aWq78QTKGzzp5UPU8vZchQ0rPJ+8eISxiLIhXo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037