UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n9p+uUEN/gNwFNjfsiMBqEmkx0PzZHOkuakOONXXFe8=' 
WHERE 
  key_id = 'd36f065e15b5cf35b5282011e9a2b35c9e54f484a50c1de15e43c918e68f86d2' 
  AND (
    token = 'n9p+uUEN/gNwFNjfsiMBqEmkx0PzZHOkuakOONXXFe8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038