UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gOSmWDxLZhlrkQmNyiUbGUu21uUrGW5tpe6YepMwVMI=' 
WHERE 
  key_id = '7d584a3560c86461724b79a9a9ae0210ebd0f26caed158dcea2a7fe3095b50df' 
  AND (
    token = 'gOSmWDxLZhlrkQmNyiUbGUu21uUrGW5tpe6YepMwVMI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026