UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kZCuYVkIWr+II1YsHlOvGzXKEajPlOuOc50EJg4tS/4=' 
WHERE 
  key_id = '640a9f3673b5d3f589250183970442e0410d4e5c9bea6a1113cf460f1d32f717' 
  AND (
    token = 'kZCuYVkIWr+II1YsHlOvGzXKEajPlOuOc50EJg4tS/4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032