UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CA3Et93z2XX6YtJWXzMr1Og0+kxapUBz3Gj4wyaDMTE=' 
WHERE 
  key_id = 'ca5ae4b9c8a96710f8be0f7edf4d10710203ac5961cb9e17ab863acea938a371' 
  AND (
    token = 'CA3Et93z2XX6YtJWXzMr1Og0+kxapUBz3Gj4wyaDMTE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044