UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r1tcfC6pfA93EHTUL+oAr9zH9YjpSIl5pMb3TyS4lfY=' 
WHERE 
  key_id = '89204e7882d16a173617109b57dd5b3b7f8b210adf64fe830f1583777232c3a0' 
  AND (
    token = 'r1tcfC6pfA93EHTUL+oAr9zH9YjpSIl5pMb3TyS4lfY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033