UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qc9Ymq0UV9Wfl6Ae1R3J2LGzI9K4zjoxun/Lui4T94o=' 
WHERE 
  key_id = '8321da073131d2082d9fc077373e2431d79032616937da95f34318fe5e850885' 
  AND (
    token = 'Qc9Ymq0UV9Wfl6Ae1R3J2LGzI9K4zjoxun/Lui4T94o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041